<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  var options = {iceRestart: false};

  async function negotiate() {
    await pc.setLocalDescription(await pc.createOffer(options));
    io.send({desc: pc.localDescription});
  }

  // negotiate: 协商
  pc.onnegotiationneeded = () => negotiate();

  pc.oniceconnectionstatechange = (e) => {
    options.iceRestart = pc.iceConnectionState === 'failed';
  };
</script>
</body>
</html>
